Skip to content

ECN support - #837

Merged
Sean-Der merged 1 commit into
mainfrom
ecn
Sep 16, 2026
Merged

Sean-Der merged 1 commit into
mainfrom
ecn

Conversation

@penhauer

Copy link
Copy Markdown
Contributor

This part is the tricky part for supporting ECN. If the underlying socket is a UDPConn, ReadMsgUDP(buf, oob) is used which returns out of band data like ToS. It works fine for now, but I honestly haven't thought about the cases where the conn is not a pure socket, but a class that implements net.PacketConn (like a Proxy or a Wrapper), and in this case we don't want to bypass the Wrapper's methods. However, for now, I think this is fine.

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.08955% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.29%. Comparing base (9b8daf6) to head (b587e48).

Files with missing lines Patch % Lines
ecn_unix.go 72.97% 5 Missing and 5 partials ⚠️
candidate_base.go 89.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #837      +/-   ##
==========================================
- Coverage   88.50%   88.29%   -0.21%     
==========================================
  Files          46       47       +1     
  Lines        6505     6554      +49     
==========================================
+ Hits         5757     5787      +30     
- Misses        505      518      +13     
- Partials      243      249       +6     
Flag Coverage Δ
go 88.29% <82.08%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation preserves wrapper semantics, handles platform fallbacks, and includes focused coverage for metadata propagation.

Pull request overview

Adds ECN metadata reception for ICE packets on supported Unix platforms while preserving wrapper behavior.

Changes:

  • Reads IPv4/IPv6 ECN values from UDP ancillary data.
  • Exposes packet metadata through Conn.ReadWithAttributes.
  • Adds ECN parsing and end-to-end tests.
File summaries
File Description
transport.go Adds the public ECN metadata API.
candidate_base.go Propagates packet attributes through receive handling.
ecn_unix.go Implements Unix UDP ancillary-data parsing.
ecn_other.go Provides the unsupported-platform fallback.
ecn_unix_test.go Tests ECN parsing and delivery.
go.mod Promotes x/sys to a direct dependency.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Carry UDP ECN codepoints in packetio.Attributes
and expose reusable Conn.ReadWithAttributes
reads.

Handle IPv4 and IPv6 control messages on Unix.

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, I finished this and integrated it with the new transport attributes API, I put ECN behind a "unix" flag (linux || darwin || freebsd), I'm not sure how to do it for windows and I don't have a real way to test it on windows right now (I can do that later).

@JoTurk
JoTurk requested a review from Sean-Der September 16, 2026 07:44

@Sean-Der Sean-Der left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIITTTTSSS HAPPENING! Amazing thank you @JoTurk

@Sean-Der
Sean-Der merged commit 23eada5 into main Sep 16, 2026
19 checks passed
@Sean-Der
Sean-Der deleted the ecn branch September 16, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants